Skip to content

Conversation

alicetrifu
Copy link
Contributor

Compiler path was wrongly created when anything was set on the "Prefix" option from "Cross Settings". The code needs to check if anything is set there before creating the default path for the compiler.

Copy link

github-actions bot commented Apr 10, 2025

Test Results

  584 files   -    34    584 suites   - 34   14m 2s ⏱️ - 22m 28s
9 887 tests  - 1 216  9 863 ✅  - 1 096  24 💤  - 120  0 ❌ ±0 
9 925 runs   - 1 193  9 901 ✅  - 1 075  24 💤  - 118  0 ❌ ±0 

Results for commit fec0b2a. ± Comparison against base commit fd06dca.

This pull request removes 1217 and adds 1 tests. Note that renamed tests count towards both.
org.eclipse.cdt.debug.gdbjtag.core.tests.jtagdevice.GDBJtagDeviceContributionTest ‑ testGdbJtagDeviceContribution
org.eclipse.cdt.debug.gdbjtag.core.tests.launch.GDBJtagLaunchTest ‑ testGdbJtagLaunch[gdb]
org.eclipse.cdt.debug.gdbjtag.core.tests.launch.GDBJtagLaunchTest ‑ testGdbJtagLaunch[gdbserver]
org.eclipse.cdt.tests.dsf.gdb.tests.CommandLineArgsTest ‑ testSettingArgumentsWithQuotes[gdb]
org.eclipse.cdt.tests.dsf.gdb.tests.CommandLineArgsTest ‑ testSettingArgumentsWithQuotes[gdbserver]
org.eclipse.cdt.tests.dsf.gdb.tests.CommandLineArgsTest ‑ testSettingArgumentsWithSpecialSymbols[gdb]
org.eclipse.cdt.tests.dsf.gdb.tests.CommandLineArgsTest ‑ testSettingArgumentsWithSpecialSymbols[gdbserver]
org.eclipse.cdt.tests.dsf.gdb.tests.CommandLineArgsTest ‑ testSettingArgumentsWithSymbols[gdb]
org.eclipse.cdt.tests.dsf.gdb.tests.CommandLineArgsTest ‑ testSettingArgumentsWithSymbols[gdbserver]
org.eclipse.cdt.tests.dsf.gdb.tests.CommandLineArgsTest ‑ testSettingArgumentsWithTabs[gdb]
…
org.eclipse.cdt.managedbuilder.core.tests.CompilationDatabaseGenerationTest ‑ testGetCompilerArgsWithSpacesAndQuotes

♻️ This comment has been updated with latest results.

@alicetrifu alicetrifu force-pushed the fixPathForCompiler1130 branch from 1151c1e to dabaf25 Compare April 10, 2025 14:34
@alicetrifu alicetrifu force-pushed the fixPathForCompiler1130 branch from dabaf25 to 080da79 Compare April 10, 2025 15:11
Copy link
Member

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like roughly the correct solution. Just some cleanup and review the caching.

@alicetrifu alicetrifu force-pushed the fixPathForCompiler1130 branch from 080da79 to d448a14 Compare April 10, 2025 15:57
Copy link
Member

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well in the normal cases, but there are some corner cases that aren't handled well, see the individual comments.

@alicetrifu alicetrifu force-pushed the fixPathForCompiler1130 branch from d448a14 to 2c4aa3f Compare April 11, 2025 07:41
@ghentschke
Copy link
Contributor

@alicetrifu Is this PR still work in progress?

@alicetrifu
Copy link
Contributor Author

Hello @ghentschke ,

This should be done. I see that the logs are not available anymore for this, but the comments should be fixed. I see that meanwhile this got into conflict. Should I fix this?

@ghentschke
Copy link
Contributor

ghentschke commented Sep 4, 2025

Should I fix this?

That would be great. I think we should fix this, since another user has stumbled around this issue. See eclipse-cdt/cdt-lsp#531 (comment)

but the comments should be fixed.

Yes

@alicetrifu
Copy link
Contributor Author

@ghentschke, I have fixed the conflict directly form the Github UI. I hope this is fine. Will wait for the final result of the checks. Thank you!

@ghentschke
Copy link
Contributor

ghentschke commented Sep 5, 2025

There is still a failed unit test. I am not sure if it relates to this PR.
I don't think so, as other lately build PR have same broken unit test.

@alicetrifu
Copy link
Contributor Author

@ghentschke , This does not seem to be related to my PR indeed. But I am not sure why I have the problem with the Licence. I had this in the past as well and @Kummallinen rerun this for me. I think there are some issues with my permissions. Any idea on what I should do next to fix this ? Thank you!

@ghentschke
Copy link
Contributor

But I am not sure why I have the problem with the Licence.

I think there is a general problem with the license server at the moment. See eclipse-cdt/cdt-lsp#535 (comment)

@alicetrifu
Copy link
Contributor Author

Thamk you @ghentschke! Do I need to make any additional changes here? Not sure how to fix the failing test since I am sure it's not releated to this PR. Please let me know what you think about the status here. Thank you!

@ghentschke
Copy link
Contributor

ghentschke commented Sep 8, 2025

@jonahgraham Do you have any objections here?

@ghentschke
Copy link
Contributor

Hi @alicetrifu ,
I tested this PR on Windows 11 with a cross compiler toolchain and found this issue here:
image
The = will be not converted correctly as the unicode escape string is used \u003d instead.
Besides that, the compiler call looks like this:

Invoking: Cross G++ Compiler
x86_64-w64-mingw32-g++ -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"MyMakefileProject.d" -MT"MyMakefileProject.o" -o "MyMakefileProject.o" "../MyMakefileProject.cpp"

and this is the compile_commands.json line:

"command": "\"C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe\" -O2 -g -Wall -c -fmessage-length\u003d0 -o /MyMakefileProject.o C:/Users/user/cdt/workspaces/cdt-ws_new/MyMakefileProject/MyMakefileProject.cpp",

I've seen that the -MMD -MP commands are missing. I am not sure if that's relevant.

Compiler path was wrongly created when anything was set on the "Prefix"
option from "Cross Settings". The code needs to check if anything is set
there before creating the default path for the compiler.
@jonahgraham jonahgraham force-pushed the fixPathForCompiler1130 branch from cfea01e to fec0b2a Compare October 8, 2025 10:49
Copy link
Member

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-based on main and re-approved. AFAICT this can be merged once we get a clean build.

@ghentschke

The = will be not converted correctly as the unicode escape string is used \u003d instead.

If this is a problem please raise a new issue/PR for it. If it is an issue it is a sign that the method of escaping used in the writing of compile_commands.json. I suspect it can be resolved by disabling HTML escaping in the GsonBuilder we are using here:

I've seen that the -MMD -MP commands are missing. I am not sure if that's relevant.

MMD/MP are dependency generating commands (the ones that create the extra makedfiles) (docs)

I think these are properly excluded. The CompilationDatabaseGenerator is implemented based on the GnuMakefileGenerator and excluding addDependencyOptions seems correct to me.

@ghentschke
Copy link
Contributor

If this is a problem please raise a new issue/PR for it. If it is an issue it is a sign that the method of escaping used in the writing of compile_commands.json.

I've to check that

@jonahgraham jonahgraham added this to the 12.3.0 milestone Oct 8, 2025
@jonahgraham jonahgraham merged commit c6feff5 into eclipse-cdt:main Oct 8, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CDT fails to generate correct commands in compile_commands.json file

3 participants